package main

import (
	"context"
	"log"
	"os"
	"os/signal"
	"syscall"
	"awakengo/internal/app"
)

func main() {
	application := app.NewApp()
	log.Printf("Starting application...")

	// 处理优雅退出
	sigChan := make(chan os.Signal, 1)
	signal.Notify(sigChan, syscall.SIGINT, syscall.SIGTERM)

	go func() {
		if err := application.Run(); err != nil {
			log.Fatal(err)
		}
	}()

	<-sigChan
	log.Println("Shutting down...")
	
	if err := application.Shutdown(context.Background()); err != nil {
		log.Printf("Error during shutdown: %v", err)
	}
} 